********************************************************************************
**** Ethnic Cleavages in EPR - Conflict Analysis ****
*** Author: Nils-Christian Bormann, Lars-Erik-Cederman, Manuel Vogt
*** Date: 03 Mar 2015
*** Task: Prepare JCR final submission
********************************************************************************

********************************************************************************
**** Header
clear
capture cd "C:/Uni/Data/Eclipse_Workbench/EPR EC Onset Paper" // Working Directory
set more off, perm
*set matsize 8000
*set maxvar 10000

********************************************************************************
**** Data Setup
use "data/CleavageConflict-Data.dta"

/*******************************************************************************
**** Variable definitions

** cleavage variables are recorded in the cleavage_varcharacter_vartype_referencegroup format
* cleavage:
// lang_* = all language related variables
// rel_* = all religion related variables
* variable character:
// diff = difference
// dist = distance (in tree)
* variable type:
// mean = difference/distance is calculated on all subsegments and then averaged: bounded b/w 0 and 1
// maj = the difference/distance is calculated on the majority sub-segment: dummy
* reference group
// tit = titular (most powerful or sizable groups in case of multiple senior partners)
// egip = groups in power (all ethnic groups with access to executive power)

// lang_diffp1_mean_tit & rel_diffp1_mean_tit etc.: 
	* difference computed for parent-level 1 using trees
	
// lang_diffp2_mean_tit & rel_diffp2_mean_tit etc.: 
	* difference computed for parent-level 2 using trees	
	
// lxr_mean & lxr_maj: interaction between linguistic and religious cleavages

// lang_diff_maj_tit2 & rel_diff_maj_tit2: 
	* 0 for dyads with cleavage on the respective other dimension

// lr_diff_maj_tit: only codes cleavages when both are present

// civdiv: Religious (majority) differences on the highest tree level

// muslim_flag: any dyad that involves at least one Muslim group
// muslim_egip: any dyad with a Muslim group in the government
// muslim_meg: any dyad with a Muslim group as a potential challenger (Group B)
// muslim_both: any dyad where both groups have majority Muslim membership
// rel_diff_maj_tit_mm: all religious differences without Muslim involvment

// country_lang: language is most common difference in country-year
// country_rel: religion is most common difference in country-year
// country_lr: language and religion together constitute most common difference in country-year
// country_race: race is most common difference in country-year

// ethfrac: Ethnic Fractionalization
// ethpol: Ethnic Polarization
// nstar: fractionalization with respect to power relations in country (Cederman & Girardin 2007)

// onset_do_flag: Ethnic civil war onset (ACD2EPR database) 
	* conflict coding from UCDP/PRIO Armed Conflict Database with 25 battle-deaths threshold and 2-year intermission prior to new onset
	* ethnic conflict coded when rebel organization claims to fight on behalf of ethnic group AND recruits from that group

// status_excl: Ethnic group (Group B) excluded from executive power
// family_downgraded2: Ethnic group (Group B) lost relative power in past two years
// groupsize: Relative size of ethnic group in country-year
// family_warhist: Count of all previous civil wars this group or umbrella groups were involved in
// ln_rgdppc_lag: Natural logarithm of GDP per capita (lagged by 1 year) from Hunziker and Bormann (2013)
// lpopl:  Natural logarithm of country's population size (lagged by 1 year) from Hunziker and Bormann (2013)
// family_peaceyears: Time since last conflict or independence of country 

*/

	
********************************************************************************
********************************************************************************
**** Main Analysis


********************************************************************************
*** Table 1: Main specifications

** Model 1
logit onset_do_flag lang_diff_mean_tit rel_diff_mean_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* if statusid > 2, ///
		vce(cluster cowid) nolog
test lang_diff_mean_tit = rel_diff_mean_tit


** Model 2
logit onset_do_flag lang_diff_maj_tit rel_diff_maj_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
		if statusid > 2, vce(cluster cowid) nolog
test lang_diff_maj_tit = rel_diff_maj_tit 

** Model 3
logit onset_do_flag lang_diff_maj_tit2 rel_diff_maj_tit2 lr_diff_maj_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
		if statusid > 2, vce(cluster cowid) nolog
test lang_diff_maj_tit2 = rel_diff_maj_tit2

		
** Model 4
logit onset_do_flag lang_diff_maj_tit2 rel_diff_maj_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* if statusid > 2, ///
		vce(cluster cowid) nolog
test lang_diff_maj_tit2 = rel_diff_maj_tit


********************************************************************************
*** Table 2: Post-Cold war differences, civilizations, Muslims
** Model 5
logit onset_do_flag lang_diff_maj_tit rel_diff_maj_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
		if statusid > 2 & year >= 1990, vce(cluster cowid) nolog

** Model 6
logit onset_do_flag lang_diff_maj_tit2 rel_diff_maj_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
		if statusid > 2 & year >= 1990, vce(cluster cowid) nolog		

** Model 7
logit onset_do_flag lang_diff_maj_tit civdiv ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
		if statusid > 2 & year >= 1990, vce(cluster cowid) nolog

** Model 8
logit onset_do_flag lang_diff_maj_tit rel_diff_maj_tit_mm muslim_flag ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
		if statusid > 2 & year >= 1990, vce(cluster cowid) nolog


********************************************************************************
********************************************************************************
**** Appendix B: Descriptive Statistics
	
********************************************************************************
*** Table B1: Summary statistics all variables		
su lang_diff_mean_tit lang_diff_maj_tit lang_diff_maj_tit2 ///
	rel_diff_mean_tit rel_diff_maj_tit rel_diff_maj_tit2 lr_diff_maj_tit ///
	lang_diff_maj_egips rel_diff_maj_egips lang_diff_mean_egips rel_diff_mean_egips ///
	civdiv muslim_flag muslim_egip muslim_meg muslim_both ///
	hindu buddhist sikh jewish muslim animist atheist ///
	onset_do_flag  status_excl family_downgraded2 groupsize family_warhist ///
	ln_rgdppc_lag lpopl ln_oilpc_lag family_peaceyears inc_spline*
	

*** Table B2: Correlation matrix of variables main variables		
estpost correlate lang_diff_mean_tit rel_diff_mean_tit status_excl ///
					family_downgraded2 groupsize family_warhist ln_rgdppc_lag ///
					lpopl family_peaceyears ethfrac ethpol, matrix listwise


********************************************************************************
********************************************************************************
**** Appendix C: Additional Results

********************************************************************************
*** Table C1: Cross Tabs
tab onset_do_flag lang_diff_maj_tit, r co chi2 clrchi2
tab onset_do_flag rel_diff_maj_tit, r co chi2 clrchi2

********************************************************************************
*** Table C1: Regional differences (Figure xx in main paper
* West
logit onset_do_flag lang_diff_mean_tit rel_diff_mean_tit /// 
		groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
		if statusid > 2 & west == 1, vce(cluster cowid) nolog		
		
* Eastern Europe
logit onset_do_flag lang_diff_mean_tit rel_diff_mean_tit ///
		status_excl groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
		if statusid > 2 & eeurop == 1, vce(cluster cowid) nolog
	
* Asia
logit onset_do_flag lang_diff_mean_tit rel_diff_mean_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
		if statusid > 2 & asia == 1, vce(cluster cowid) nolog
		
* Sub-Saharan Africa
logit onset_do_flag lang_diff_mean_tit rel_diff_mean_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
		if statusid > 2 & ssafrica == 1, vce(cluster cowid) nolog
		
* North Africa and the Middle East
logit onset_do_flag lang_diff_mean_tit rel_diff_mean_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
		if statusid > 2 & nafrme == 1, vce(cluster cowid) nolog

		
***************************************************************************************************************************************************************************************************************************
*** Figure 8: Religion Dummies
* Religious identity dummies (either group a or b)
logit onset_do_flag lang_diff_mean_tit /// 
			hindu buddhist sikh jewish muslim animist atheist ///
			status_excl family_downgraded2 groupsize family_warhist ///
			ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
			if statusid > 2 , nolog vce(cluster cowid)


***************************************************************************************************************************************************************************************************************************
***************************************************************************************************************************************************************************************************************************
**** Appendix D: Additional Robustness Tests

***************************************************************************************************************************************************************************************************************************
*** Table D1: Cold War Models

** Model 1
logit onset_do_flag lang_diff_maj_tit rel_diff_maj_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
		if statusid > 2 & year < 1990, vce(cluster cowid) nolog

** Model 2
logit onset_do_flag lang_diff_maj_tit2 rel_diff_maj_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
		if statusid > 2 & year < 1990, vce(cluster cowid) nolog		

** Model 3
logit onset_do_flag lang_diff_maj_tit civdiv ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
		if statusid > 2 & year < 1990, vce(cluster cowid) nolog

** Model 4
logit onset_do_flag lang_diff_maj_tit rel_diff_maj_tit_mm muslim_flag ///
		ln_oilpc_lag status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
		if statusid > 2 & year < 1990, vce(cluster cowid) nolog

** Model 5
* Create interaction variables
gen time = year - 1946
gen lanxt = lang_diff_maj_tit * time
gen relxt = rel_diff_maj_tit * time
logit onset_do_flag lang_diff_maj_tit lanxt time rel_diff_maj_tit relxt ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* /// 
		if statusid > 2 , vce(cluster cowid) nolog


********************************************************************************
*** Table D2: Only linguistic, only religious cleavages, language-religion interaction, disaggregated Muslim differences

** Model 6
logit onset_do_flag lang_diff_mean_tit  ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* if statusid > 2, ///
		vce(cluster cowid) nolog

** Model 7
logit onset_do_flag rel_diff_mean_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* if statusid > 2, ///
		vce(cluster cowid) nolog

** Model 8
logit onset_do_flag lang_diff_mean_tit rel_diff_mean_tit lxr_mean /// 
			status_excl family_downgraded2 groupsize family_warhist ///
			ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
			if statusid > 2 , nolog vce(cluster cowid)

** Model 9
logit onset_do_flag lang_diff_maj_tit rel_diff_maj_tit lxr_maj /// 
			status_excl family_downgraded2 groupsize family_warhist ///
			ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
			if statusid > 2 , nolog vce(cluster cowid)

** Model 10: Muslim EGIP (1), Muslim MEG (2), both Muslims (3); base category: no Muslims
logit onset_do_flag lang_diff_maj_tit rel_diff_maj_tit_mm ///
			muslim_egip muslim_meg muslim_both /// 
			status_excl family_downgraded2 groupsize family_warhist ///
			ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
			if statusid > 2 , nolog vce(cluster cowid)

********************************************************************************
*** Table D3: Fearon distances and higher order differences (2nd/3rd)
** Model 11:
logit onset_do_flag lang_dist_mean_tit rel_dist_mean_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* if statusid > 2, ///
		vce(cluster cowid) nolog
test lang_dist_mean_tit = rel_dist_mean_tit

** Model 12:
logit onset_do_flag lang_diffp1_mean_tit rel_diffp1_mean_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* if statusid > 2, ///
		vce(cluster cowid) nolog
test lang_diffp1_mean_tit = rel_diffp1_mean_tit

** Model 13:
logit onset_do_flag lang_diffp1_maj_tit rel_diffp1_maj_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
		if statusid > 2, vce(cluster cowid) nolog
test lang_diffp1_maj_tit = rel_diffp1_maj_tit 		

** Model 14:
logit onset_do_flag lang_diffp2_mean_tit rel_diffp2_mean_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* if statusid > 2, ///
		vce(cluster cowid) nolog
test lang_diffp2_mean_tit = rel_diffp2_mean_tit

** Model 15:
logit onset_do_flag lang_diffp2_maj_tit rel_diffp2_maj_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
		if statusid > 2, vce(cluster cowid) nolog
test lang_diffp2_maj_tit = rel_diffp2_maj_tit 		

********************************************************************************
*** Table D4: linguistic and religious differencs to all EGIPS
** Model 16:
logit onset_do_flag lang_diff_mean_egips rel_diff_mean_egips ///
					status_excl family_downgraded2 groupsize family_warhist ///
					ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
					if statusid > 2, vce(cluster cowid) nolog 
** Model 17:
logit onset_do_flag lang_diff_maj_egips rel_diff_maj_egips ///
					status_excl family_downgraded2 groupsize family_warhist ///
					ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
					if statusid > 2, vce(cluster cowid) nolog 


********************************************************************************
*** Table D5: Multi-way clustering	(country, year)
** Model 18:
logit2 onset_do_flag lang_diff_mean_tit rel_diff_mean_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* if statusid > 2, ///
		fcluster(cowid) tcluster(year)
test lang_diff_mean_tit = rel_diff_mean_tit

** Model 19:
logit2 onset_do_flag lang_diff_maj_tit rel_diff_maj_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
		if statusid > 2, fcluster(cowid) tcluster(year)
test lang_diff_maj_tit = rel_diff_maj_tit 

** Model 20:
logit2 onset_do_flag lang_diff_maj_tit2 rel_diff_maj_tit2 lr_diff_maj_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
		if statusid > 2, fcluster(cowid) tcluster(year)
test lang_diff_maj_tit2 = rel_diff_maj_tit2

** Model 21:
logit2 onset_do_flag lang_diff_maj_tit2 rel_diff_maj_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* if statusid > 2, ///
		fcluster(cowid) tcluster(year)
test lang_diff_maj_tit2 = rel_diff_maj_tit


********************************************************************************
*** Table D6: Hierarchical models					
** Model 22:					
xtmelogit onset_do_flag lang_diff_mean_tit rel_diff_mean_tit ///
					status_excl family_downgraded2 groupsize /// 
					family_warhist ln_rgdppc_lag lpopl ///
					family_peaceyears inc_spline* if statusid > 2 ///
					|| cowid: || cowgroupid:

** Model 23:								
xtmelogit onset_do_flag lang_diff_maj_tit rel_diff_maj_tit ///
					status_excl family_downgraded2 groupsize /// 
					family_warhist ln_rgdppc_lag lpopl ///
					family_peaceyears inc_spline* if statusid > 2 ///
					|| cowid: || cowgroupid:


********************************************************************************
*** Table D8: Table 1 - Model 2 + Various Fixed Effects Specifications
sort cowid year
** Model 24: Country-FE
logit onset_do_flag lang_diff_maj_tit rel_diff_maj_tit ///
					status_excl family_downgraded2 groupsize family_warhist ///
					ln_rgdppc_lag lpopl family_peaceyears inc_spline* i.cowid ///
					if statusid > 2, vce(cluster cowgroupid) nolog

** Model 25: Year FE
logit onset_do_flag lang_diff_maj_tit rel_diff_maj_tit ///
					status_excl family_downgraded2 groupsize family_warhist ///
					ln_rgdppc_lag lpopl family_peaceyears inc_spline* i.year ///
					if statusid > 2, vce(cluster cowgroupid) nolog
					
** Model 26: Country + Year FE
logit onset_do_flag lang_diff_maj_tit rel_diff_maj_tit ///
					status_excl family_downgraded2 groupsize family_warhist ///
					ln_rgdppc_lag lpopl family_peaceyears inc_spline*  ///
					i.cowid i.year ///
					if statusid > 2, vce(cluster cowgroupid) nolog 					
test lang_diff_maj_tit = rel_diff_maj_tit

** Model 27: Country-Year FE
xtset cyear
xtlogit onset_do_flag lang_diff_maj_tit rel_diff_maj_tit ///
					status_excl family_downgraded2 groupsize family_warhist ///
					ln_rgdppc_lag lpopl family_peaceyears inc_spline*  ///
					if statusid > 2, fe nolog 					
test lang_diff_maj_tit = rel_diff_maj_tit

********************************************************************************
*** Table D7: Table 1 - Model 1 + Various Fixed Effects Specifications
sort cowid year
** Model 28: Country-FE
logit onset_do_flag lang_diff_mean_tit rel_diff_mean_tit ///
					status_excl family_downgraded2 groupsize family_warhist ///
					ln_rgdppc_lag lpopl family_peaceyears inc_spline* i.cowid ///
					if statusid > 2, vce(cluster cowgroupid) nolog

** Model 29: Year-FE
logit onset_do_flag lang_diff_mean_tit rel_diff_mean_tit ///
					status_excl family_downgraded2 groupsize family_warhist ///
					ln_rgdppc_lag lpopl family_peaceyears inc_spline* i.year ///
					if statusid > 2, vce(cluster cowgroupid) nolog
					
** Model 30: Country + Year FE
logit onset_do_flag lang_diff_mean_tit rel_diff_mean_tit ///
					status_excl family_downgraded2 groupsize family_warhist ///
					ln_rgdppc_lag lpopl family_peaceyears inc_spline*  ///
					i.cowid i.year ///
					if statusid > 2, vce(cluster cowgroupid) nolog 					
test lang_diff_mean_tit = rel_diff_mean_tit

** Model 31: Country-Year FE
xtlogit onset_do_flag lang_diff_mean_tit rel_diff_mean_tit ///
					status_excl family_downgraded2 groupsize family_warhist ///
					ln_rgdppc_lag lpopl family_peaceyears inc_spline*  ///
					if statusid > 2, fe nolog
test lang_diff_mean_tit = rel_diff_mean_tit



***************************************************************************************************************************************************************************************************************************
*** Table D9: Table 1 - Model 3 + Various Fixed Effects Specifications
sort cowid year
** Model 32: Country-FE
logit onset_do_flag lang_diff_maj_tit2 rel_diff_maj_tit2 lr_diff_maj_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* i.cowid ///
		if statusid > 2, vce(cluster cowgroupid) nolog

** Model 33: Year FE
logit onset_do_flag lang_diff_maj_tit2 rel_diff_maj_tit2 lr_diff_maj_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* i.year ///
		if statusid > 2, vce(cluster cowgroupid) nolog
					
** Model 34: Country + Year FE
logit onset_do_flag lang_diff_maj_tit2 rel_diff_maj_tit2 lr_diff_maj_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* i.cowid i.year ///
		if statusid > 2, vce(cluster cowgroupid) nolog

** Model 35: Country-Year FE
xtlogit onset_do_flag lang_diff_maj_tit2 rel_diff_maj_tit2 lr_diff_maj_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
		if statusid > 2, fe nolog


********************************************************************************
**** Table D10: Table 1 - Model 4 + Various Fixed Effects Specifications
sort cowid year
** Model 36: Country-FE
logit onset_do_flag lang_diff_maj_tit2 rel_diff_maj_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* i.cowid ///
		if statusid > 2, vce(cluster cowgroupid) nolog

** Model 37: Year FE
logit onset_do_flag lang_diff_maj_tit2 rel_diff_maj_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* i.year ///
		if statusid > 2, vce(cluster cowgroupid) nolog
					
** Model 38: Country + Year FE
logit onset_do_flag lang_diff_maj_tit2 rel_diff_maj_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* i.cowid i.year ///
		if statusid > 2, vce(cluster cowgroupid) nolog

** Model 39: Country-Year FE
xtlogit onset_do_flag lang_diff_maj_tit2 rel_diff_maj_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
		if statusid > 2, fe nolog


********************************************************************************
**** Table D11: Table 1 - Model 2  + fractionalization, polarization, nstar
** Model 40: Ethnic fractionalization
logit onset_do_flag lang_diff_mean_tit rel_diff_mean_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl ethfrac family_peaceyears inc_spline* if statusid > 2, ///
		vce(cluster cowid) nolog
test lang_diff_mean_tit = rel_diff_mean_tit

** Model 41: Ethnic polarization
logit onset_do_flag lang_diff_mean_tit rel_diff_mean_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl ethpol family_peaceyears inc_spline* if statusid > 2, ///
		vce(cluster cowid) nolog
test lang_diff_mean_tit = rel_diff_mean_tit

** Model 42: N-Star
logit onset_do_flag lang_diff_mean_tit rel_diff_mean_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl nstar family_peaceyears inc_spline* if statusid > 2, ///
		vce(cluster cowid) nolog
test lang_diff_mean_tit = rel_diff_mean_tit

** Model 43: Country-level cleavages
logit onset_do_flag lang_diff_mean_tit rel_diff_mean_tit ///
		status_excl family_downgraded2 groupsize family_warhist ///
		ln_rgdppc_lag lpopl country_lang country_rel country_lr ///
		family_peaceyears inc_spline* if statusid > 2, vce(cluster cowid) nolog
test lang_diff_mean_tit = rel_diff_mean_tit
		

********************************************************************************
*** Figures D1 + D2: Imben's sensitivity tests 
** Explore sensitivity of results to omitted variables
logit onset_do_flag lang_diff_mean_tit rel_diff_mean_tit ///
					status_excl family_downgraded2 groupsize family_warhist ///
					ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
					if statusid > 2, vce(cluster cowid) nolog

** Push statistical significance of linguistic difference below .1 level
gsa onset_do_flag lang_diff_mean_tit rel_diff_mean_tit ///
				  status_excl family_downgraded2 groupsize family_warhist ///
				  ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
				  if statusid > 2, vce(cluster cowid) lowess ylogit ///
				  tstat(1.645) observation(250) resolution(75)

** Push statistical significance of linguistic difference below .05 level
gsa onset_do_flag lang_diff_mean_tit rel_diff_mean_tit ///
				  status_excl family_downgraded2 groupsize family_warhist ///
				  ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
				  if statusid > 2, vce(cluster cowid) lowess ylogit ///
				  tstat(1.96) observation(250) resolution(75)

** Half the effect size			  
gsa onset_do_flag lang_diff_mean_tit rel_diff_mean_tit ///
				  status_excl family_downgraded2 groupsize family_warhist ///
				  ln_rgdppc_lag lpopl family_peaceyears inc_spline* ///
				  if statusid > 2, vce(cluster cowid) lowess ylogit ///
				  tau(.55) observation(250) resolution(75)
